package com.tushare.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tushare.entity.Margin;
import com.tushare.mapper.MarginMapper;
import com.tushare.service.IMarginService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-03-08
 */
@Service
public class MarginServiceImpl extends ServiceImpl<MarginMapper, Margin> implements IMarginService {

    @Override
    public Margin getLastMargin() {
        return getBaseMapper().getLastMargin();
    }

    @Override
    public List<Margin> getMarginListByTsCode(int trade_date) {
        return getBaseMapper().getMarginListByTsCode(trade_date);
    }

    @Override
    public List<Margin> getTopMarginList(int limit) {
        return getBaseMapper().getTopMarginList(limit);
    }

    @Override
    public boolean saveOrUpdateBatch(List<Margin> list) {
        if (list == null) {
            return false;
        }
        if (list.size() == 0) {
            return true;
        }
        return getBaseMapper().saveOrUpdateBatch(list);
    }

    @Override
    public boolean deleteAllMargin() {
        return getBaseMapper().deleteAllMargin();
    }
}
